<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="common/header.jsp"%>


<div class="x_panel">
	<div class="x_title">
		<h2>
			APP信息管理维护平台${devUser.devname }<i class="fa fa-car"></i><small>王大拿专属平台...</small>
		</h2>
		<ul class="nav navbar-right panel_toolbox">
			<li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
			</li>
			<li class="dropdown"><a href="#" class="dropdown-toggle"
				data-toggle="dropdown" role="button" aria-expanded="false"><i
					class="fa fa-wrench"></i></a>
				<ul class="dropdown-menu" role="menu">
					<li><a href="#">Settings 1</a></li>
					<li><a href="#">Settings 2</a></li>
				</ul></li>
			<li><a class="close-link"><i class="fa fa-close"></i></a></li>
		</ul>
		<div class="clearfix"></div>
	</div>
	<div class="x_content">
		<br>
		<form id="demo-form2" 
			action="${pageContext.request.contextPath }/devApp/appInfoList"
			data-parsley-validate="" method="post"
			class="form-horizontal form-label-left" novalidate="">
			<input id="currentPage" type="hidden" name="currentPage" value="1">
			<ul style="list-style: none">
				<li>
					<div class="form-group">
						<label class="control-label col-md-3 col-sm-3 col-xs-12"
							for="first-name">软件名称 <span class="required">*</span>
						</label>
						<div class="col-md-6 col-sm-6 col-xs-12">
							<input name="softwarename" id="first-name" required="required"
								class="form-control col-md-7 col-xs-12" type="text" value="${appInfoCondition.softwarename }">
						</div>
					</div>
				</li>
				<li>
					<div class="form-group">
						<label class="control-label col-md-3 col-sm-3 col-xs-12"
							for="first-name">APP状态 <span class="required">*</span>
						</label>
						<div class="col-md-6 col-sm-6 col-xs-12">
							<select class="form-control col-md-7 col-xs-12" name="status">
								<option value="">--请选择--</option>
								<c:forEach items="${appStatusList }" var="appStatus">
									<option <c:if test="${appInfoCondition.status == appStatus.valueid}">selected="selected"</c:if>  value="${appStatus.valueid}">${appStatus.valuename}</option>
								</c:forEach>
							</select>
						</div>
					</div>
				</li>
				<li>
					<div class="form-group">
						<label class="control-label col-md-3 col-sm-3 col-xs-12"
							for="first-name">所属平台 <span class="required">*</span>
						</label>
						<div class="col-md-6 col-sm-6 col-xs-12">
							<select class="form-control col-md-7 col-xs-12" name="flatformid">
								<option value="">--请选择--</option>
								<c:forEach items="${appFlatFormList }" var="appFlatForm">
									<option <c:if test="${appInfoCondition.flatformid == appFlatForm.valueid}">selected="selected"</c:if> value="${appFlatForm.valueid}">${appFlatForm.valuename}</option>
								</c:forEach>
							</select>
						</div>
					</div>
				</li>
				<li>
					<div class="form-group">
						<label class="control-label col-md-3 col-sm-3 col-xs-12"
							for="first-name">一级分类 <span class="required">*</span>
						</label>
						<div class="col-md-6 col-sm-6 col-xs-12">
							<select onchange="findCategoryLevelTwo(this)" name="categorylevel1"
								class="form-control col-md-7 col-xs-12">
								<!-- 
									1.给1级分类添加onchange事件.
									2.发送ajax请求到后台,传分类的id.
									3.接收返回数据并动态的插入到二级分类中.
								 -->
								<option value="">--请选择--</option>
								<c:forEach items="${appCategoryLevelOneList }" var="appCategoryLevelOne">
									<option <c:if test="${appInfoCondition.categorylevel1 == appCategoryLevelOne.id}">selected="selected"</c:if> value="${appCategoryLevelOne.id}">${appCategoryLevelOne.categoryname}</option>
								</c:forEach>
							</select>
						</div>
					</div>
				</li>
				<li>
					<div class="form-group">
						<label class="control-label col-md-3 col-sm-3 col-xs-12"
							for="first-name">二级分类 <span class="required">*</span>
						</label>
						<div class="col-md-6 col-sm-6 col-xs-12">
							<select onchange="findCategoryLevelThree(this)" id="levelTwoSelect" class="form-control col-md-7 col-xs-12"
								name="categorylevel2">
<!-- 								 -->
								<option value="">--请选择--</option>
								<c:forEach items="${appCategoryTwoList }" var="appCategoryTwo">
									<option <c:if test="${appInfoCondition.categorylevel2 == appCategoryTwo.id}">selected="selected"</c:if> value="${appCategoryTwo.id}">${appCategoryTwo.categoryname}</option>
								</c:forEach>
							</select>
						</div>
					</div>
				</li>
				<li>
					<div class="form-group">
						<label class="control-label col-md-3 col-sm-3 col-xs-12"
							for="first-name">三级分类 <span class="required">*</span>
						</label>
						<div class="col-md-6 col-sm-6 col-xs-12">
							<select name="categorylevel3" class="form-control col-md-7 col-xs-12" id="levelThreeSelect"								name="categorylevel3">
								<option value="">--请选择--</option>
								<c:forEach items="${appCategoryThreeList }" var="appCategoryThree">
									<option <c:if test="${appInfoCondition.categorylevel3 == appCategoryThree.id}">selected="selected"</c:if> value="${appCategoryThree.id}">${appCategoryThree.categoryname}</option>
								</c:forEach>
							</select>
						</div>
					</div>
				</li>
				<div class="ln_solid"></div>
				<div class="form-group">
					<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3">
						<button type="submit" class="btn btn-primary">查询</button>
					</div>
				</div>
			</ul>
		</form>
	</div>
</div>
















<div class="x_panel">
	<div class="x_title">
		<a href="${pageContext.request.contextPath }/devApp/disAppInfoAdd" class="btn btn-success">新增APP基础信息</a>
		<div class="clearfix"></div>
	</div>
	<div class="x_content">
		<div id="datatable_wrapper"
			class="dataTables_wrapper form-inline dt-bootstrap no-footer">
			<div class="row">
				<div class="col-sm-6"></div>
			</div>
			<div class="row">
				<div class="col-sm-12">
					<table id="datatable"
						class="table table-striped table-bordered dataTable no-footer"
						role="grid" aria-describedby="datatable_info">
						<thead>
							<tr role="row">
								<th class="sorting_asc" tabindex="0" aria-controls="datatable"
									rowspan="1" colspan="1" style="width: 154px;"
									aria-sort="ascending"
									aria-label="Name: activate to sort column descending">软件名称</th>
								<th class="sorting" tabindex="0" aria-controls="datatable"
									rowspan="1" colspan="1" style="width: 250px;"
									aria-label="Position: activate to sort column ascending">APK名称</th>
								<th class="sorting" tabindex="0" aria-controls="datatable"
									rowspan="1" colspan="1" style="width: 154px;"
									aria-label="Office: activate to sort column ascending">软件大小(单位:M)</th>
								<th class="sorting" tabindex="0" aria-controls="datatable"
									rowspan="1" colspan="1" style="width: 154px;"
									aria-label="Age: activate to sort column ascending">所属平台</th>
								<th class="sorting" tabindex="0" aria-controls="datatable"
									rowspan="1" colspan="1" style="width: 250px;"
									aria-label="Start date: activate to sort column ascending">所属分类(一级分类,二级分类,三级分类)</th>
								<th class="sorting" tabindex="0" aria-controls="datatable"
									rowspan="1" colspan="1" style="width: 154px;"
									aria-label="Salary: activate to sort column ascending">状态</th>
								<th class="sorting" tabindex="0" aria-controls="datatable"
									rowspan="1" colspan="1" style="width: 154px;"
									aria-label="Age: activate to sort column ascending">下载次数</th>
								<th class="sorting" tabindex="0" aria-controls="datatable"
									rowspan="1" colspan="1" style="width: 154px;"
									aria-label="Start date: activate to sort column ascending">最新版本号</th>
								<th class="sorting" tabindex="0" aria-controls="datatable"
									rowspan="1" colspan="1" style="width: 155px;"
									aria-label="Salary: activate to sort column ascending">操作</th>	
							</tr>
						</thead>


						<tbody>
						  <c:forEach items="${pageBean.pageList }" var="appInfo">
							<tr role="row" class="even">
								<td>${appInfo.softwarename }</td>
								<td>${appInfo.apkname }</td>
								<td>${appInfo.softwaresize }</td>
								<td>${appInfo.floaformname }</td>
								<td>${appInfo.categorylevel1name }->${appInfo.categorylevel2name }->${appInfo.categorylevel3name }</td>
								<td>${appInfo.statusname }</td>
								<td>${appInfo.downloads }</td>
								<td>${appInfo.versionno }</td>
								<td>
									<div class="btn-group">
				                      <button type="button" class="btn btn-danger">点击操作</button>
				                      <button type="button" class="btn btn-danger dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
				                        <span class="caret"></span>
				                        <span class="sr-only">Toggle Dropdown</span>
				                      </button>
				                      <ul class="dropdown-menu" role="menu">
				                        <c:if test="${appInfo.status == 2 || appInfo.status == 5}">
					                        <li><a href="#">上架</a></li>
				                        </c:if>
				                        <c:if test="${appInfo.status == 4}">
				                      	  <li><a href="#">下架</a></li>
				                        </c:if>
				                        <!-- 三部
				                        	1.根据APP的id查询出他全部的版本信息.(跳转到app新增版本页面.)
				                        	2.讲用户添加的基础信息,保存到app_version表中.
				                        	3.讲app_info表中的appVersion字段修改成最新添加的.
				                         -->
				                        <li><a href="${pageContext.request.contextPath }/devApp/disAppVersionAdd/${appInfo.id}">新增APP版本信息</a></li>
				                        <li><a href="#">修改APP版本信息</a></li>
				                        
				                        <li><a href="javascript:appInfoUpdate(${appInfo.status},${appInfo.id });">修改</a></li>
				                        <li><a href="#">查看</a></li>
				                        <li><a href="#">删除</a></li>
				                      </ul>
				                    </div>
								</td>
							</tr>
							</c:forEach>	
						</tbody>
					</table>
				</div>
			</div>
		</div>
	</div>
	
	<div class="col-sm-5">
		<div class="dataTables_info" id="datatable-responsive_info"
			role="status" aria-live="polite">共${pageBean.totalCount }条记录
			${pageBean.currentPage }/${pageBean.totalPage }页</div>
	</div>
	<div class="col-sm-7">
		<div class="dataTables_paginate paging_simple_numbers"
			id="datatable-responsive_paginate">
			<ul class="pagination">
				<c:if test="${pageBean.currentPage > 1}">
					<li class="paginate_button previous"><a
						href="javascript:page(1);"
						aria-controls="datatable-responsive" data-dt-idx="0"
						tabindex="0">首页</a>
					</li>
					<li class="paginate_button "><a
						href="javascript:page(${pageBean.currentPage } - 1);"
						aria-controls="datatable-responsive" data-dt-idx="1"
						tabindex="0">上一页</a>
					</li>
				</c:if>		
				<c:if test="${pageBean.currentPage < pageBean.totalPage }">
					<li class="paginate_button "><a
						href="javascript:page(${pageBean.currentPage } + 1);"
						aria-controls="datatable-responsive" data-dt-idx="1"
						tabindex="0">下一页</a>
					</li>
					<li class="paginate_button next"><a
						href="javascript:page(${pageBean.totalPage });"
						aria-controls="datatable-responsive" data-dt-idx="7"
						tabindex="0">最后一页</a>
					</li>
				</c:if>	
			</ul>
		</div>
	</div>
	
	
</div>
























<%@include file="common/footer.jsp"%>